package com.seafwg.store.controller;

import com.seafwg.store.entity.District;
import com.seafwg.store.service.IDistrictService;
import com.seafwg.store.utils.ResultJson;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author seafwg
 * @Date 2022/4/1 11:55 下午
 * @Version 1.0
 * @description xxx
 */

@RestController
@RequestMapping("/district")
public class DistrictController extends BaseController{
    @Resource
    private IDistrictService districtService;

    /**
     * 获取省市区县列表
     * @param parent
     * @return
     */
    @GetMapping("/get")
    public ResultJson<List<District>> getDistrict(String parent) {
        List<District> list = districtService.getDistrictByParent(parent);
        return new ResultJson<>(OK, list);
    }
}
